#!coding=utf-8
from django.db import models

class Store(models.Model):
	storeName = models.CharField(u'店铺名称', max_length=100)
	storePhone = models.CharField(u'店铺联系电话', max_length=100)
	storeAddress = models.CharField(u'店铺联系地址', max_length=200)
	storeLogo = models.FileField(u'店铺logo', upload_to= 'static\\upload\\Store\\%Y\\%m-%d',null=True,blank=True)

	managerName = models.CharField(u'店铺管理者名字', max_length=20)
	managerPhone = models.CharField(u'店铺管理者电话', max_length=50)

	storeLoginName = models.CharField(u'店铺帐号', max_length=20)
	storeLoginPassword = models.CharField(u'店铺密码',max_length=20)
	storeNumber = models.CharField(u'店铺序列号',max_length=20)

	geo_x = models.CharField(u'店铺地理坐标_x',max_length=50)
	geo_y = models.CharField(u'店铺地理坐标_y',max_length=50)

	uid = models.CharField(u'店铺唯一表示',max_length=50)

	createTime = models.DateTimeField(u'添加日期',auto_now_add=True)

	disable = models.IntegerField(u'是否禁用',default=0)

class InformationCategory(models.Model):
	name = models.CharField(u'资讯类别名称',max_length=50)

	def getObj(self):
		temp = {}

		temp['id'] = self.id
		temp['name'] = self.name

		return temp

class Information(models.Model):
	title = models.CharField(u'资讯标题', max_length=50)
	source = models.CharField(u'资讯来源', max_length=50)
	context = models.TextField(u'资讯内容', default='')
	image = models.FileField(u'资讯展示图片', upload_to= 'static\\upload\\Information\\%Y\\%m-%d',null=True,blank=True)

	modifyTime = models.DateTimeField(u'修改时间',auto_now=True)
	createTime = models.DateTimeField(u'创建日期',auto_now_add=True)

	category = models.ForeignKey(InformationCategory)

	disable = models.IntegerField(u'是否禁用',default=0)

	def getObj(self):
		temp = {}

		temp['id'] = self.id
		temp['title'] = self.title
		temp['source'] = self.source
		temp['context'] = self.context
		temp['image'] = self.image.name
		temp['modifyTime'] = self.modifyTime.strftime('%Y-%m-%d %I:%M:%S')
		temp['createTime'] = self.createTime.strftime('%Y-%m-%d %I:%M:%S')
		temp['category'] = self.category.getObj()
		temp['disable'] = self.disable

		return temp

class Hospital(models.Model):
	hospitalName = models.CharField(u'医院名称', max_length=50)
	hospitalPhone = models.CharField(u'医院电话', max_length=50)
	hospitalAddress = models.CharField(u'医院地址', max_length=50)
	hospitalLevel = models.CharField(u'医院等级', max_length=50)
	hospitalWebSite = models.CharField(u'医院网站地址', max_length=100)
	hospitalDesc = models.CharField(u'医院描述', max_length=100)
	
	createTime = models.DateTimeField(u'添加日期',auto_now_add=True)

	geo_x = models.CharField(u'医院地理坐标_x', max_length=50)
	geo_y = models.CharField(u'医院地理坐标_y', max_length=50)

	disable = models.IntegerField(u'是否禁用',default=0)

class HealthRecords(models.Model):
	userName = models.CharField(u'用户名字', max_length=20)
	userSex = models.CharField(u'用户性别', max_length=20)
	userPhone = models.CharField(u'用户电话', max_length=20)
	userAddress = models.CharField(u'用户地址', max_length=50)
	
	createTime = models.DateTimeField(u'创建日期',auto_now_add=True)

	openid = models.CharField(u'接入用户编号', max_length=50)

	disable = models.IntegerField(u'是否禁用',default=0)

class PharmacistsService(models.Model):
	pharmacistsName = models.CharField(u'药师名字', max_length=20)
	pharmacistsSex = models.CharField(u'药师性别', max_length=20)
	pharmacistsPhone = models.CharField(u'药师电话', max_length=20)
	pharmactstsPic = models.FileField(u'药师头像', upload_to= 'static\\upload\\PharmacistsService\\%Y\\%m-%d',null=True,blank=True)
	pharmactstsSeniority = models.CharField(u'药师资历', max_length=20)
	pharmactstsGoodAtField = models.CharField(u'药师擅长领域', max_length=200)
	
	createTime = models.DateTimeField(u'添加日期',auto_now_add=True)

	disable = models.IntegerField(u'是否禁用',default=0)